mod csv_convert;
mod genpass;


mod base64_process;
mod process_text;

use std::fs::File;
use std::io;
use std::io::Read;
pub use csv_convert::*;

pub use genpass::*;

pub use base64_process::*;

pub use process_text::*;

pub fn read_from_file_or_console(tip: String, data: String) -> String {
    if data == "-" {
        println!("please input {} ", tip);
        let mut res = String::new();
        io::stdin().read_line(&mut res);
        res.trim().to_string()
    } else {
        let mut buf = Vec::new();
        let mut file = File::open(data).unwrap();
        file.read_to_end(&mut buf);
        let  res = String::from_utf8(buf).unwrap() ;
        res.trim().to_string()

    }
}